package com.iflysse.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.iflysse.service.StudentTaskService;
import com.iflysse.vo.AjaxResult;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@Api(tags = { "学生训练接口" })
@RestController
@RequestMapping("/studentTask")
public class StudentTaskController {
	@Autowired
	private StudentTaskService studentTaskService;
	
	@ApiOperation(value = "学生待完成训练")
	@ApiImplicitParams({
		@ApiImplicitParam(paramType = "query", name = "studentId", dataType = "String", required=true, value="学生ID"), 
		@ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "Integer", required=false, value="每页大小默认10"), 
		@ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "Integer", required=false, value="默认显示第1页")
	})
	@PostMapping("/queryWaitingTask")
	public Object getAllWaitingTask(@RequestParam(defaultValue = "1") Integer pageNum,
			@RequestParam(defaultValue = "10") Integer pageSize, String studentId) {
		Object list = studentTaskService.getWaitingTask(pageNum, pageSize, studentId);
		return AjaxResult.success(list);

	}
	@ApiOperation(value = "学生完成训练")
	@ApiImplicitParams({
		@ApiImplicitParam(paramType = "query", name = "studentId", dataType = "String", required=true, value="学生ID"), 
		@ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "Integer", required=false, value="每页大小默认10"), 
		@ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "Integer", required=false, value="默认显示第1页")
	})
	@PostMapping("/queryCompleteTask")
	public Object getAllCompleteTask(@RequestParam(defaultValue = "1") Integer pageNum,
			@RequestParam(defaultValue = "10") Integer pageSize, String studentId) {
		Object list = studentTaskService.getQueryCompleteTask(pageNum, pageSize, studentId);
		return AjaxResult.success(list);

	}
	@ApiOperation(value = "学生完成训练展示部分")
	@ApiImplicitParams({
		@ApiImplicitParam(paramType = "query", name = "studentId", dataType = "String", required=true, value="学生ID"), 
		@ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "Integer", required=false, value="每页大小默认10"), 
		@ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "Integer", required=false, value="默认显示第1页")
	})
	@PostMapping("/queryTopFourWaitingTask")
	public Object getFourWaitingTask(@RequestParam(defaultValue = "1") Integer pageNum,
			@RequestParam(defaultValue = "4") Integer pageSize, String studentId) {
		Object list = studentTaskService.getTopFourWaitingTask(pageNum, pageSize, studentId);
		return AjaxResult.success(list);

	}
	@ApiOperation(value = "学生待完成训练展示部分")
	@ApiImplicitParams({
		@ApiImplicitParam(paramType = "query", name = "studentId", dataType = "String", required=true, value="学生ID"), 
		@ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "Integer", required=false, value="每页大小默认4"), 
		@ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "Integer", required=false, value="默认显示第1页")
	})
	@PostMapping("/queryTopFourCompleteTask")
	public Object getQueryFourCompleteTask(@RequestParam(defaultValue = "1") Integer pageNum,
			@RequestParam(defaultValue = "4") Integer pageSize, String studentId) {
		Object list = studentTaskService.getQueryTopFourCompleteTask(pageNum, pageSize, studentId);
		return AjaxResult.success(list);

	}
}
